<html>
<head><meta charset="utf-8"><title>how best to override &quot;Trait not implemented for ...&quot; · t-compiler/wg-diagnostics · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/index.html">t-compiler/wg-diagnostics</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/how.20best.20to.20override.20.22Trait.20not.20implemented.20for.20.2E.2E.2E.22.html">how best to override &quot;Trait not implemented for ...&quot;</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="177350274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/how%20best%20to%20override%20%22Trait%20not%20implemented%20for%20...%22/near/177350274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/how.20best.20to.20override.20.22Trait.20not.20implemented.20for.20.2E.2E.2E.22.html#177350274">(Oct 04 2019 at 15:31)</a>:</h4>
<p>I'm working on <a href="https://github.com/rust-lang/rust/issues/63438" target="_blank" title="https://github.com/rust-lang/rust/issues/63438">#63438</a>, and currently my problem is that I get errors that say "the trait <code>std::marker::Structural</code> is not implemented for <code>std::cell::Cell&lt;&amp;u32&gt;</code>"</p>



<a name="177350304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/how%20best%20to%20override%20%22Trait%20not%20implemented%20for%20...%22/near/177350304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/how.20best.20to.20override.20.22Trait.20not.20implemented.20for.20.2E.2E.2E.22.html#177350304">(Oct 04 2019 at 15:31)</a>:</h4>
<p>when what I would want to say is "to use a constant of type <code>std::cell::Cell</code> in a pattern, <code>std::cell::Cell</code> must be annotated with `#[derive(PartialEq, Eq)]"</p>



<a name="177350387"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/how%20best%20to%20override%20%22Trait%20not%20implemented%20for%20...%22/near/177350387" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/how.20best.20to.20override.20.22Trait.20not.20implemented.20for.20.2E.2E.2E.22.html#177350387">(Oct 04 2019 at 15:32)</a>:</h4>
<p>is there a standard way to achieve this sort of mis-direction in the compiler, in terms of saying "when this trait is not implemented, use <em>this</em> message instead" ?</p>



<a name="177350507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/how%20best%20to%20override%20%22Trait%20not%20implemented%20for%20...%22/near/177350507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/how.20best.20to.20override.20.22Trait.20not.20implemented.20for.20.2E.2E.2E.22.html#177350507">(Oct 04 2019 at 15:33)</a>:</h4>
<p>hmm, actually ... maybe I could just do the check in question without signalling an error ...</p>



<a name="177350636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/how%20best%20to%20override%20%22Trait%20not%20implemented%20for%20...%22/near/177350636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/how.20best.20to.20override.20.22Trait.20not.20implemented.20for.20.2E.2E.2E.22.html#177350636">(Oct 04 2019 at 15:35)</a>:</h4>
<p>yeah never mind me, I'm the one who put in a call to <code>infcx.report_fulfillment_error</code>; I can just not do that, I think</p>



<a name="177495429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/how%20best%20to%20override%20%22Trait%20not%20implemented%20for%20...%22/near/177495429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/how.20best.20to.20override.20.22Trait.20not.20implemented.20for.20.2E.2E.2E.22.html#177495429">(Oct 07 2019 at 07:11)</a>:</h4>
<p>we have <code>rustc_on_unimplemented</code></p>



<a name="177495478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/how%20best%20to%20override%20%22Trait%20not%20implemented%20for%20...%22/near/177495478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/how.20best.20to.20override.20.22Trait.20not.20implemented.20for.20.2E.2E.2E.22.html#177495478">(Oct 07 2019 at 07:12)</a>:</h4>
<p>which I think is exactly for this case</p>



<a name="177498313"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/how%20best%20to%20override%20%22Trait%20not%20implemented%20for%20...%22/near/177498313" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/how.20best.20to.20override.20.22Trait.20not.20implemented.20for.20.2E.2E.2E.22.html#177498313">(Oct 07 2019 at 08:05)</a>:</h4>
<p>oh yeah, true</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>